<!-- Jquery Validate -->
<script src="js/plugins/validate/jquery.validate.min.js"></script>
<div id="sqzxlist" class="row">
    <div class="col-lg-12">
        <div class="ibox float-e-margins">
            <div class="ibox-content">
                <div class="tabs-container">
                    <div class="tab-content">
                        <div id="tab-6" class="tab-pane active">
                            <div class="row">
                                <form role="form" id="form_modify_pass" action="update">
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label>*原密码：</label>
                                            <input id="pwd1" name="pwd1" type="password" placeholder="请输入原密码 " class="form-control">
                                        </div>
                                        <div class="form-group">
                                            <label>*新密码：</label>
                                            <input id="pwd2" name="pwd2" type="password" placeholder="请输入新密码 " class="form-control">
                                        </div>
                                        <div class="form-group">
                                            <label>*确认密码：</label>
                                            <input id="pwd3" name="pwd3" type="password" placeholder="请输入确认密码" class="form-control">
                                        </div>
                                        <div>
                                            <br/>
                                            <button class="btn btn-sm btn-primary ladda-button" data-style="zoom-in" id="btn_add_route" onclick="" type="submit">保存</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<Script>
    $.getJSON({
        url: bathpath + '/v1/dyForm/view',
        type: 'post',
        contentType: "application/json",
        // data: JSON.stringify({
        //     formId: "10000000"
        // })
        data: {
            formId: "10000000"
        }
    })
        .done(function (data) {
            if (ajaxdatacheck(data)) {
                if (data.code == 1) {
                    console.log(data.content)
                    analyseTree(data)
                } else {
                    swal({
                        title: '出错了',
                        text: data.errorMsg || data.msg,
                        type: "warning"
                    })
                }
            }
        })
        .fail(function (e) {
            console.error(e.statusText)
        })
        .always(function () {
            // if (instance)
            //     instance.stop();
        })

    $.mockjax({
        url: bathpath + '/v1/dyForm/view',
        contentType: "application/json",
        responseTime: 500,
        response: function (req) {
            var dyForm_id = req.data.formId
            console.log('测试======' + dyForm_id);
            this.responseText = {
                "code": 1,
                "msg": "操作成功",
                "errorMsg": null,
                "content": [
                    { attr_id: '100000', attr_name: '单位名称', dict_id: '10', form_id: '12000', max_length: '50', required: 'true', status: '1', type: 'text' },
                    { attr_id: '100000', attr_name: '单位名称', dict_id: '10', form_id: '12000', max_length: '50', required: 'true', status: '1', type: 'text' },
                ]
            }
        },

    })

    //解析动态表单
    function analyseTree(data) {
        var con;
        for (con in data.content) {
            // console.log(data.content[con])
            var conTypt = data.content[con]
            drawing(conTypt);
            // console.log('------------------' + conTypt.type)
        }
    }
    //渲染界面
    function drawing(instance) {
        switch (instance.type) {
            case "text":
                console.log('---text')
                break
            case "text":
                console.log('---text')
                break
            case "text":
                console.log('---text')
                break
            default:
                break;
        }
    } 
</Script>